package com.lanhai.ads.controller;

import com.lanhai.ads.model.*;
import com.lanhai.ads.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
@Api(tags="统计结果查询接口")
@RestController
@RequestMapping("/rpt")
public class ReportController {
    @Autowired
    ReportService reportService;
    @ApiOperation(value = "车辆班次搬运量统计", notes = "day: `YYYY-MM-DD`, workshift: `day`,`night`")
    @GetMapping("/transfer/day/{day}/workshift/{workshift}")
    public List<RptTransfer> transferEveryAgv(@PathVariable String day, @PathVariable String workshift) throws ParseException {
        return reportService.listRptTransfer(day, workshift);
    }
    @ApiOperation(value = "日搬运量统计", notes = "begin: 2021-09-09, end: 2021-09-20")
    @GetMapping(value = "/transfer_day/begin/{begin}/end/{end}")
    public List<RptTransferDay> transferDay(@PathVariable String begin, @PathVariable String end) throws ParseException {
        return reportService.listRptTransferDay(begin, end);
    }
    @ApiOperation("整年月度搬运量统计")
    @GetMapping("/transfer_month/{year}")
    public List<RptTransferMonth> transferMonth(@PathVariable Integer year) throws ParseException {
        //查询指定年度的各月搬运量
        return reportService.listRptTransferMonth(year, null, null);
    }
    @ApiOperation("任意月度搬运量统计")
    @GetMapping("/transfer_month/{year}/begin/{begin}/end/{end}")
    public List<RptTransferMonth> transferMonth(@PathVariable Integer year, @PathVariable Integer begin,@PathVariable Integer end) {
        //查询指定年度的各月搬运量
        return reportService.listRptTransferMonth(year, begin, end);
    }

    @ApiOperation(value = "各工序班次搬运量统计", notes = "day: YYYY-MM-DD,workshift: `day`,`night`")
    @GetMapping("/transfer_step/day/{day}/workshift/{workshift}")
    public List<RptTransferStep> transferStep(@PathVariable String day, @PathVariable String workshift) throws ParseException {
        return reportService.listRptTransferStep(day, workshift);
    }


    @ApiOperation(value = "车辆班次运行情况统计", notes = "day: YYYY-MM-DD,workshift: `day`,`night`")
    @GetMapping("/statetime/day/{day}/workshift/{workshift}")
    public List<RptStateTime> stateTime(@PathVariable @ApiParam("YYYY-MM-DD") String day, @PathVariable @ApiParam("day") String workshift) throws ParseException {
        return reportService.listRptStateTime(day, workshift);
    }



}
